<script>
export default {
  name: 'TimeFormat',
  props: {
    date: {
      type: String,
      default: ''
    },
    type: {
      type: String,
      default: 'day'
    }
  },
  computed: {
    getDay() {
      const day = new Date(this.date)
      if (this.type === 'day') {
        return day.getDate().toString()
      } else {
        return day.getFullYear() + '-' + (day.getMonth() + 1).toString()
      }
    }
  }
}
</script>

<template>
  <div>{{ getDay }}</div>
</template>

<style scoped>

</style>
